"""tracer URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url, include
from web.view import account, home, project, manage, wiki

urlpatterns = [

    # 用户部分
    url(r'^register/$', account.register, name='register'),
    url(r'^send/sms/$', account.send_sms, name='send_sms'),
    url(r'^login/sms/$', account.login_sms, name='login_sms'),
    url(r'^login/$', account.login, name='login'),
    url(r'^image/code/$', account.image_code, name='image_code'),
    url(r'^logout/$', account.logout, name='logout'),
    url(r'^index/$', home.index, name='index'),
    # url(r'^ajax_register$', account.ajax_register, name='ajax_register')

    # 项目列表
    url(r'^project/list/$', project.project_list, name='project_list'),
    # /project/star/my/1/
    # /project/star/join/1/
    url(r'^project/star/(?P<project_type>\w+)/(?P<project_id>\d+)/$', project.project_star, name='project_star'),
    url(r'^project/unstar/(?P<project_type>\w+)/(?P<project_id>\d+)/$', project.project_unstar, name='project_unstar'),

    # 项目管理
    # 路由分发
    url(r'^manage/(?P<project_id>\d+)/', include([
        url(r'^dashboard$', manage.dashboard, name='dashboard'),
        url(r'^issues$', manage.issues, name='issues'),
        url(r'^statistics$', manage.statistics, name='statistics'),
        url(r'^file$', manage.file, name='file'),
        url(r'^wiki$', wiki.wiki, name='wiki'),
        url(r'^setting$', manage.setting, name='setting'),
    ], None)),

    # url(r'^manage/(？P<project_id>\d+)/dashboard$', manage.dashboard, name='dashboard'),
    # url(r'^manage/(？P<project_id>\d+)/issues$', manage.issues, name='issues'),
    # url(r'^manage/(？P<project_id>\d+)/statistics$', manage.statistics, name='statistics'),
    # url(r'^manage/(？P<project_id>\d+)/file$', manage.file, name='file'),
    # url(r'^manage/(？P<project_id>\d+)/wiki$', manage.wiki, name='wiki'),
    # url(r'^manage/(？P<project_id>\d+)/setting$', manage.setting, name='setting'),

]
